
package com.platform.modules.event.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.common.utils.Query;
import com.platform.modules.event.dao.EventCalendarCategoryDao;
import com.platform.modules.event.entity.EventCalendarCategoryEntity;
import com.platform.modules.event.service.EventCalendarCategoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 模块--分类表Service实现类
 *
 * @author 
 * @date 2020-10-16 09:39:57
 */
@Service("eventCalendarCategoryService")
public class EventCalendarCategoryServiceImpl extends ServiceImpl<EventCalendarCategoryDao, EventCalendarCategoryEntity> implements EventCalendarCategoryService {

    @Override
    public List<EventCalendarCategoryEntity> queryAll(Map<String, Object> params) {
        return baseMapper.queryAll(params);
    }

    @Override
    public Page queryPage(Map<String, Object> params) {
        //排序
        params.put("sidx", "T.id");
        params.put("asc", false);
        Page<EventCalendarCategoryEntity> page = new Query<EventCalendarCategoryEntity>(params).getPage();
        return page.setRecords(baseMapper.selectEventCalendarCategoryPage(page, params));
    }

    @Override
    public boolean add(EventCalendarCategoryEntity eventCalendarCategory) {
        return this.save(eventCalendarCategory);
    }

    @Override
    public boolean update(EventCalendarCategoryEntity eventCalendarCategory) {
        return this.updateById(eventCalendarCategory);
    }

    @Override
    public boolean delete(String id) {
        return this.removeById(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteBatch(String[] ids) {
        return this.removeByIds(Arrays.asList(ids));
    }
}
